Repository navigation
merge: sync upstream main (8e647374) into fork - #89
Merged
Merged
Conversation
… view A view that is not opaque answers mouseDownCanMoveWindow with YES, so since the view's opacity follows a translucent window, AppKit moved the whole window from any press in the title-bar band, taking a tab drag from the page. The page declares its own move regions, which start the drag themselves. Paired with a Motty tools commit that adds a window-drag step for realwin.
A field that scrolls its own line laid the line out in a label as wide as the field. The platform rasterizes a label only within its box, so the end of a line scrolled past the field's left edge was blank while the caret sat at the field's right edge: a long address or key showed only its start. Draw the line in a box from its left end to the field's right edge instead. The part past the edge is clipped anyway, so no text is measured for it, and the origin and alignment of the line are unchanged. The headless darwin test renders a scrolled field through the native editor path and checks its end reaches the field's edge; the component test asserts the line's box covers the field on every platform. No Motty commit: the fix is in Viva's input painter, and Motty builds against ../viva directly.
A Drawer anchored to a window's top edge put its title and close button under the window buttons of a custom titlebar: Motty's scheme browser drew "All schemes" beneath macOS's traffic lights (t8y2/motty#2002). The painter now records the strip's height on the canvas as TitlebarHeight, beside TitlebarInsets, zero for a system titlebar and in full screen, and the page Drawer's viewport starts at the strip's bottom edge, as a sheet attaches under the titlebar. The scrim and the dismiss target follow the viewport, so a press on the strip is not a press on the drawer, and a spec's Inset that already leaves out more keeps the smaller area. Refs: t8y2/motty#2002
a3b9ea1 started a Drawer's viewport below the titlebar strip, which turned the panel into a sheet hanging under the titlebar instead of the full-height sheet it is. The viewport covers the window again, the frame less the spec's Inset; the panel runs under the titlebar's window buttons as a sidebar does, and only its header starts at the strip's bottom edge, as far as the panel reaches into it (components.DrawerOptions.HeaderInset, fed from Canvas.TitlebarHeight by the ui layer). A header with a close button is at least the button's height, so a one-line title's button no longer reaches into the body. Refs: t8y2/motty#2002
macOS machines without a Metal device (for example Intel virtual machines) used to fail to open a window. The window now falls back to the CPU rasterizer that Linux already runs: the retained scene lives in the new internal/softscene package, shared with the Linux CPU path, CoreText supplies label and native-editor pictures as pixels, and the view presents the canvas in a plain layer. Metal machines keep the existing path; Windows is unchanged. Verified on a macOS 14 Intel VM without Metal: Motty starts and draws its pages, dialogs and a 30k-line terminal, with typing and scrollback. Motty needs no code change; it uses the fallback by opening a window.
A node's rectangle reaches the element in window coordinates, and the element kept it as its accessibilityFrame. AppKit and every client read that property as screen coordinates, so VoiceOver, automation and a window manager reading the tree placed each control at the window's origin, and the place stayed behind when the window was moved. Convert the painted rectangle through the view's window when the frame is read, so it is on screen and follows a move made outside the application without another paint. The native test builds the element and checks the frame of a window that is never shown, before and after it moves with no repaint in between. Refs: t8y2/motty#2021
The CPU drawing fallback calls vivaTextOverlayChanged from the view's render, and the native test programs keep their own callback stubs so they link without the cgo side. Every program that includes native.m now provides the callback, so the window tests build again.
The -tags vivahead renderer required a Metal device, so screenshots could not be taken on a Mac without one, and there was no way to exercise the CPU pipelines on a machine that has a device. The darwin offscreen renderer now falls back to the same CPU scene the window uses, drawing CoreText labels and the native editor's picture as pixels; Linux and macOS headless builds accept VIVA_SOFTWARE_RENDERING=1 to ask for it, and a macOS window honors it too. Adds pixel tests for the offscreen scene and editor overlay, benchmarks for a page-shaped and terminal-shaped frame, and records the method and numbers in docs/benchmarks. README and conformance state the fallback. Verified on a macOS 14 Intel VM without Metal: Motty's vivahead build returns its texts, a clean layout and a 2800x1800 screenshot, and the window path draws a 30k-line terminal.
A fixed-pitch line's picture ended where its bounds did, so a glyph wider than its cell (an emoji, an icon font glyph, an italic one) was cut at the first and last column even where the canvas clip had room for it. The picture is now one cell wider on each side, with every run moved right by as many columns so each glyph stays where the line put it. A clip that cuts the wider picture still scissors it. Every backend lays runs out from the label's left edge, so none needs to change. Applications no longer have to widen their own labels; Motty's local workaround for column-0 clipping is replaced by this (t8y2/motty#2024).
The macOS adapter reported a window's content size without the display scale, so the application's painter never learned the device pixels per logical pixel and painted every frame for an unknown scale. A terminal cell then kept its font's fractional advance instead of rounding to whole device pixels, and the cell glyph geometry snapped to a different grid than the rectangle it sits on: a column-dependent one-pixel seam appeared in front of a powerline cap (#2032). The window now passes NSScreen.backingScaleFactor with every resize and reports the content size and scale once when it opens, before its first visible frame (the first frame is laid out before the window exists and must be repainted on the real grid; the CPU renderer is ready by then). Moving to a display of another scale reports both again, and its Go handler repaints at the new scale. The new native test checks all three reports. Companion: the Motty change that stops pre-rounding cell rectangles to half a point, so the canvas snaps the background and the glyph once.
… in tight rooms Box.Hit on a Splitter renames the divider but left SplitterState.ID on the old name, so SplitterState.Key rejected the arrow keys of the focused divider; the rename now updates the state, which an application no longer has to patch by hand. When the room cannot hold both minimums, a splitter with a Ratio now keeps the divider at the share the Ratio names and the minimums give way, instead of the first pane keeping its minimum and the second taking what is left. Pos and Ratio then agree in a narrow window, which an application that mirrors the share into its own pane layout needs. A splitter without a Ratio is unchanged. Companion: motty drops its local copies of both workarounds (t8y2/motty, keyboard pane divider resizing, #2039).
… minimums The ratio hold added with the renamed-hit fix has no consumer: the application that asked for it keeps its panes as fractions of a frame and caps the minimums it passes at its own seam, which is its layout rule, not a framework gap. Keep the splitter's minimums-first behaviour until a real caller needs another. The Hit rename fix stays.
Tests could read the accessibility tree but could not make the requests a screen reader makes: the handler the platform adapters call was private to package app. Driver.PerformAccess takes a typed app.AccessRequest (press, focus, increment, decrement, set number, set text, set selection) and hands it to that same handler, so modal, disabled, read-only and role refusals are the ones assistive technology meets. headless.Session gains PerformAccess and LocateNode, which resolves the existing selector grammar against nodes without hit testing (assistive technology does not press at a point), and the line protocol gains "access ACTION SEL [VALUE]" answered "ok handled" or "ok refused". Writing the modal test exposed a real gap: a modal left nodes behind it out of the published tree, but a request that still named one (a UIA job queued, or a node reference held, before the modal opened) was carried out. interaction.Control now takes the trapped focus scope and finds nothing outside it, on the native painter and the web mirror.
Viva's diagnostics cover failures and the first frame; nothing showed why a window keeps painting, so redundant redraws and idle wake-ups had to be found by reading code. VIVA_TRACE=1 makes every window (native or the headless driver) write one line to stderr per event it receives and per frame it paints: the frame's reasons, paint passes and page retries, paint and publish time, instance and upload counts, an "empty" marker for a frame that gave the platform nothing to do, and the present time where the adapter reports presentation. A wake whose paint a hidden window skips is reported too. An idle window prints nothing. Reasons are a typed bit set (internal/frametrace.Reason) recorded where a frame is requested and merged per frame: painter.repaint and scheduleFrame take a reason, platform.Waker gathers the reasons of the wakes a redraw answers (WakeFor, Redrawing), and the frame timer carries the reasons of its requests to the wake-up it posts, so a direct repaint in between does not take a timer frame's cause. Scheduling is unchanged. The trace is not routed through the diagnostic stream: frames are not failures and their volume would evict the events a capture ring keeps. A window holds a nil *frametrace.Window unless the variable is set, so the cost when off is one nil check per call site; a steady frame allocates nothing with the trace off or on (TestMidFlightFramesDoNotAllocate covers both, BenchmarkMidFlightFrame measures them).
Add gfx.RoleColumnHeader, gfx.SortDirection (SortNone, SortAscending, SortDescending) and HitOptions/Hit.Sort and MultiSelectable, carried through the semantic tree to platform.AccessibilityNode (with ChangedSort and ChangedMultiSelectable) and app.AccessNode. Platform mapping: - macOS: a column header is AXButton with subrole AXSortButton and AXSortDirection, as an NSTableView header cell. AppKit has no multi-selectable attribute; not exposed. - Windows UIA: HeaderItem (50035) with Invoke; sort as AriaProperties "sort=..." and ItemStatus while sorted; Selection.CanSelectMultiple now reports MultiSelectable instead of always false, with property events. - Linux AT-SPI: ROLE_COLUMN_HEADER, object attribute "sort", state MULTISELECTABLE, AttributesChanged/state-changed events. - Web: role=columnheader with aria-sort, aria-multiselectable on a listbox, and options/grid cells now use aria-selected instead of aria-current. The headless control flags and the inspector print the new states. The reload wire does not carry them, as it does not carry Level or Mixed.
Table multi-selection reuses the List's choice model: the anchor, the Shift range (macOS replaces the last range, elsewhere replaces the rest unless Primary is held), Primary toggle, Primary+arrows moving without choosing, Control+Space off macOS and Primary+A now live in one rowChoice type in base/rowchoice.go that ListState and TableState both keep. API: - TableState.Selection *Selection (opt-in, List's name and semantics; nil keeps one row at a time), TableState.Chosen(row) bool. - TableSpec.Checkboxes bool replaces TableSpec.Checked *Selection, and TableState.CheckedChanged is removed: the checkbox column now shows and edits TableState.Selection (a tick is a Primary click; the header chooses all or none; Space ticks the focused row), so a ticked row and a chosen row are one thing, as in a desktop details view with item checkboxes and as Arco's rowSelection type=checkbox. Changed reports ticks, clicks and keys alike. - Selected/Select/Changed keep their meaning for one-row tables; Select of the row already selected no longer resets the Shift anchor, so an application that syncs its own row every paint keeps the user's range. - SortBy cycles ascending, descending, unsorted (Arco's default sortDirections, then cancel); ClearSort stays. - A Table's element Label now names its rows' listbox. Accessibility: the body is a RoleListBox container (MultiSelectable with a Selection) and each row a RoleOption whose Selected is Chosen; a sortable header is RoleColumnHeader with its Sort. The rows and their checkboxes are one Tab stop (the focused, else selected, else first visible row). Also fixes a nil Selection dereference when Shift+arrow was pressed in a List that chooses one row; it now moves the choice. References: shadcn has no data-table selection model (its example binds a checkbox column to the row selection, as here); Arco Table rowSelection (selectedRowKeys, type checkbox, checkAll) and Column sortDirections. We deviate from Arco where desktop convention differs: a plain row click chooses that row alone, Shift/Primary ranges and toggles exist, and the vocabulary is List's (Selection, Changed) rather than rowSelection keys. Desktop acceptance checklist: - Keyboard: arrows/Home/End/PageUp/PageDown move; Shift extends from the anchor; Primary moves without choosing; Control+Space toggles (not on macOS, where it switches input source); Space toggles with Checkboxes and otherwise does not replace a multi choice; Primary+A chooses all; Enter and Space on a focused sortable header sort; rows are one Tab stop. - Pointer: click, Shift-click, Primary-click; hover unchanged. Right click does not change the choice (unchanged; a context menu on a row outside the choice is left to the application). - Focus: the focus ring follows the row the keys are on; Tab returns to the selected row. No dialogs involved. - Text: no text input; typeahead in tables is not added. - Density: no geometry changed. - Window: N/A, no window behavior involved. - Accessibility: listbox (multi-selectable), options with selected, column headers with sort, mapped per platform in the companion commit. Verified with go vet (darwin, dev tag, linux/windows/js cross vet) and a Motty workbench vet against this tree; tests were written but not run. No Motty change: its keys and credentials tables keep one-row semantics.
The CPU renderer merged every change of a frame into one bounding rectangle, so a caret in the content and a clock in a corner repainted almost the whole window. Damage is now a raster.Region: at most four disjoint rectangles, merged where the bounding box grows least when a fifth arrives, and drawn as the whole canvas once it covers 60% of it. The rasterizer sorts the scene once and draws it into each rectangle; softscene.Paint returns the rectangles. X11 sends a PutImage per rectangle with one flush, Wayland keeps a region per wl_buffer and damages each rectangle, GTK queues each. A region of a caret and a clock draws in 6 us instead of 3 ms for their bounding box (1280x800, M2 Pro), with no allocation. The macOS CPU window built a CGImage over its own pixel buffer without a copy, then wrote the next frame into the same memory and freed it on resize while Core Animation could still read the image. It now shows a swap chain of up to three BGRA, sRGB-tagged IOSurfaces as the layer's contents: a frame is copied into a surface other than the one shown and that the window server no longer uses (IOSurfaceIsInUse), under IOSurfaceLock, and the Go side keeps per surface the region it missed since it was last filled, so a reused surface gets exactly that and a new, resized or emptied one gets the whole canvas. The retained Go canvas stays the source of truth and one copy of the damage remains: catching up a stale or emptied surface is then a copy, not a repaint, the rasterizer never reads purgeable memory, and no Go code holds a pointer into a locked surface. Surfaces are released on resize and when the window closes. Idle and hidden windows give buffers back. The 2 s delay the Windows driver trim used is now platform.IdleTrimDelay, shared by every platform. On macOS a one-shot performSelector timer, armed once per burst and re-armed for the remainder, makes the surfaces off screen kIOSurfacePurgeableVolatile; a third surface that only a burst needed goes volatile as soon as the server lets go of it, so a blinking caret keeps two. While the window is occluded the shown surface is volatile too; on acquire or when the window shows again a surface is made non-volatile, and if the system emptied it, it is refilled whole (vivaCPUSurfaceLost shows the canvas again). On X11 the PutImage packing buffer is dropped once the window has been idle for the delay, by bounding the event loop's poll once; an unmapped window releases its canvases and corner shadows, which the full present answering the next expose makes again. Nothing runs while idle after a release.
A window manager resizes a window by setting its accessibility size, and macOS 26 runs that geometry change as a spring animation: AppKit calls -setFrameSize: once per animation step, on the main thread. Every step reached the application synchronously, which laid the whole window out and drew it, and the resize callback then waited for its frame to be scheduled. A sample of a frozen window (t8y2/motty#2021) shows the animation inside -[NSWindow _resizeFromWindowManagerWithTargetGeometry:springSettings:], the draws blocked in -[CAMetalLayer nextDrawable] because both of the layer's drawables were in flight, and the window taking no input until the animation ended minutes later. - A size change the window manager makes now waits for the run loop, so an animation costs one layout pass instead of one per step. A live resize, whose frame has to land in the transaction that changes the bounds, is still reported inside the pass and still waits for its frame. - A frame the layer accepted but has not presented keeps the next frame from taking the last drawable: the view draws the held frame once the one in flight is presented instead of blocking the main thread. A frame that never reaches the screen after two seconds is treated as dropped, so a failed presentation cannot stop drawing for good. The native test drives three animated steps and one live step and checks that the animation reports once and the live resize reports at once.
This was referenced Dec 2, 2026
16 of 19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge upstream
vivaui/vivamain(8e6473748cd0) intoLithe-IDEA/Lithe-vivamainbefore desktop v0.8.25 release. Zero merge conflicts;ui/...,text/...,go vet, and Windows amd64/arm64 cross-builds pass.